package com.ysx.server.mapper;

import com.ysx.server.pojo.entity.Message;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageMapper {
    @Insert("insert into second_hand_trading.message(sendName, receiveName, message, parentId) VALUES (#{sendName}, #{receiveName}, #{message}, #{parentId})")
    void save(Message message);
    @Select("select * from second_hand_trading.message where sendName=#{userName} or receiveName=#{userName}")
    List<Message> getByUser(String userName);
}
